@import './block.scss';
@import './border.scss';
@import './map.scss';
@import './gamepad.scss';

html,body {
  width: 100%;
  height: 100%;
  margin: 0px;
  padding: 0px;
  background: #333;
  overflow: hidden;
  font-family: 'Roboto', 'Trebuchet MS', 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
}

@font-face {
  font-family: 'ccr';
  src: url('./fonts/ccr.ttf');
  src: url('./fonts/ccr.ttf') format('truetype');
}

@font-face {
  font-family: 'hun2';
  src: url('./fonts/hun2.ttf');
  src: url('./fonts/hun2.ttf') format('truetype');
}

.main {
  height: 100%;
  display: flex;
  flex-direction: column;
  user-select: none;

  > .background {
    position: absolute;
    width: 100%;
    height: 100%;
    user-select: none;
    pointer-events: none;
  }

  > .mask {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(10,10,10,0.1);
    transition: all 0.2s ease;
  }

  &.playing {
    > .mask {
      background: rgba(10,10,10,0.7);
    }

    .gamepad {
      background: rgba(255, 255, 255, 0.9);
    }
  }

  .playfield {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;

    .tetris-window {
      position: relative;
      display: flex;
      flex-direction: row-reverse;
      justify-content: center;

      & + .tetris-window {
        margin-left: 20px;
      }

      .stat {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        margin-left: 16px;
        margin-top: -8px;

        .bordered {
          margin-top: 8px;
          display: flex;
          flex-direction: column;
          align-items: flex-start;
        }

        .title {
          padding-right: 2px;
          color: rgba(255, 255, 255, 0.7);
          font-family: 'ccr';
          font-size: 18px;
        }

        .next {
          position: relative;
          border: none;
          background: transparent;
 
          .block-container {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            margin-top: -24px;
            padding-top: 8px;
            width: 100%;
            min-width: calc(var(--block-cell-size) * 4);
            min-height: calc(var(--block-cell-size) * 2 * var(--next-block-queue-capacity)
              + (24px * var(--next-block-queue-capacity))); 
            transform: unset;

            .block {
              --brightness: 1;
              position: relative;
              margin-top: 24px;

              .cell {
                --shadow-color: rgba(0,0,0,0.8);
              }
            }
          }
        }

        .counter {
          border: none;
          background: transparent;

          .num {
            padding-right: 2px;
            font-family: 'ccr';
            font-size: 30px;
            font-weight: bold;
            color: #fff;
          }
        }
      }
    }
  }
}

.button {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  border-radius: 1px;
  border: none;
  outline: none;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(0,0,0,0.6);
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
  box-shadow: 1px 1px 4px 0px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  background-color: rgba(255,255,255,0.9);
  transition: background-color .5s ease;
  box-sizing: border-box;
  user-select: none;

  &:active {
    box-shadow: 0 0 0 0.1rem #fff;
  }
}
.desktop .button:hover {
  box-shadow: 0 0 0 0.1rem #fff;
}

.key-table {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 300px;
  border-color: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  border-collapse: collapse;
  background: rgba(0,0,0,0.8);
  color: lightskyblue;
  font-size: 14px;
  transform: translate(-50%, -50%);
  transition: all 0.2s ease;

  &.hide {
    opacity: 0;
  }

  &.show {
    opacity: 1;
  }

  caption {
    background: transparent;
    padding: 4px;
    font-weight: bolder;
  }

  tr {
    td,th {
      padding: 4px;
    }

    td:nth-child(1) {
      width: 120px;
      text-align: center;
    }
    td:nth-child(2) {
      padding-left: 8px;
      width: 140px;
    }
  }

  .key {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 2px 8px;
    min-width: 20px;
    height: 20px;
    border-radius: 4px;
    text-align: center;
    line-height: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: #fafafa;
  }
}